home *** CD-ROM | disk | FTP | other *** search
Text File | 1986-01-22 | 1.3 KB | 62 lines | [TEXT/ttxt] |
- \ 3 Dimensional Array
- \ 1/07/85 cdn Logical extension to 2dArray
-
- :CLASS 3dArray <Super 2dArray 4 <Indexed
-
- Int xbnd
-
- \ ( xbnd -- ) Store x bound; y & z bound already used by super 2dArray
- :M CLASSINIT: classinit: super put: xbnd ;M
-
- \ ( -- ) Allocate arrays for third dimension
- :M NEW:
- new: super
- ylimit: super 0
- DO
- xlimit: super 0
- DO
- get: xbnd heap> array i j to: super
- LOOP
- LOOP
- ;M
-
- \ ( val x y z -- )
- :M TO: to: [ at: super ] ;M
-
- \ ( x y z -- )
- :M AT: at: [ at: super ] ;M
-
- \ ( -- ) Deallocate array space in heap
- :M DISPOSE:
- ylimit: super 0
- DO
- xlimit: super 0
- DO
- i j at: super killptr
- LOOP
- LOOP
- dispose: super
- ;M
-
- :M XLIMIT: get: xbnd ;M
-
- :M YLIMIT: xlimit: super ;M
-
- :M ZLIMIT: ylimit: super ;M
-
- :M PRINT: { \ k -- }
- zlimit: self 0
- DO CR ." layer:" i . CR
- i -> k
- ylimit: self 0
- DO CR
- xlimit: self 0
- DO
- i j k at: self .
- LOOP
- LOOP
- LOOP
- ;M
-
- ;CLASS
-